// JavaScript Document


//获取焦点
(function(){
	var oText=getClass(document,'text')[0];
	oText.onfocus=function(){
		oText.value="";
		}
	oText.onblur=function(){
		if(oText.value==""){
			oText.value="输入国家、城市、个性玩法等关键词";
			}
    	}	
})();



//nav下拉菜单
/*(function nav(){
	var oDiv=getClass(document,'nav')[0];
	var aLi=oDiv.getElementsByTagName('li');
	var aNav=[];
	var aDl=oDiv.getElementsByTagName('dl');
	var i=0;
	var num=0;
	var timer=null;
	for(var i=0;i<aLi.length;i++){
		if(aLi[i].children.length>1){
			aNav.push(aLi[i].children[0]);
		}
	}	
	for(i=0;i<aNav.length;i++)
	{
		aNav[i].index=i;
		aNav[i].onmouseover=function list()
		{	
			clearInterval( timer );
			num=this.index;
			for(i=0;i<aNav.length;i++){
				aDl[i].style.display='none';
				}
			aDl[num].style.display='block';	
			
		}
	
		aNav[i].onmouseout=function()
		{			
			num=this.index;
			timer = setTimeout(function(){	
				aDl[num].style.display='none';
				}, 500);
	    }
		
		aDl[i].onmouseover=function(){
			clearInterval( timer );
			}
			
		aDl[i].onmouseout=function()
		{	
			num=this;
			timer = setTimeout(function(){	
				num.style.display='none';
				}, 500);
	    }
			
	}
	
})();*/




//banner图片轮播
(function banner(){
	var oDiv=getClass(document,'banner')[0];
	var aLi=getClass(oDiv,'ad')[0].getElementsByTagName('li');
	var aBtnLi=getClass(oDiv,'dot')[0].getElementsByTagName('li');
	var i=0;
	var num=0;
	for(i=0;i<aBtnLi.length;i++){
		aBtnLi[i].index=i;
		aBtnLi[i].onmouseover=function(){
			num=this.index;
			tab();
			}
		}

	function tab(){
		for(i=0;i<aBtnLi.length;i++){
			aBtnLi[i].className="";
			aLi[i].style.opacity=0;
			aLi[i].style.display='none';
			}
		aBtnLi[num].className="active";
		move(aLi[num],{opacity:100});
		aLi[num].style.display='block';
		}
				
	function autoplay(){
		if(num>=aBtnLi.length-1){
			num=0;
			}
		else{
			num++;		
			}
		tab();
		}
		
	timer=setInterval(autoplay,3000);
	oDiv.onmouseover=function(){
		clearInterval(timer);
		}
	oDiv.onmouseout=function(){
		timer=setInterval(autoplay,3000);
		}	
	
	
	})();


	
//遮罩	
(function pic(){
	var oDiv=getClass(document,'pic');
	var oMask=getClass(document,'picmask');
	var i=0;
	for(i=0;i<oDiv.length;i++){
		oDiv[i].index=i;
		oDiv[i].onmouseover=function(){
			move(oMask[this.index],{bottom:0});
			//oMask[this.index].style.bottom=0;
			
			}
		oDiv[i].onmouseout=function(){
			move(oMask[this.index],{bottom:-28});
			//oMask[this.index].style.bottom='-28px';
			}
		}
})();




//无缝滚动
(function list(){
	var oList=getClass(document,'imglist')[0];
	var oUl=oList.getElementsByTagName('ul')[0];
	var aLi=oList.getElementsByTagName('li');
	var liWidth=aLi[0].offsetWidth;
	oUl.innerHTML=oUl.innerHTML+oUl.innerHTML;
	oUl.style.width=liWidth*aLi.length+'px';
	var timer=null;
	timer=setInterval(function(){
		var L=oUl.offsetLeft;
		L=L+2;
		if(L>=0){
			L=-oUl.offsetWidth/2;
			}
		
		oUl.style.left=L+'px';
	},30)
})();
